Lesson 8: Using the hand model & detecting multiple hands
Purpose: To use a pre-trained model that finds a hand in a live webcam picture, returns its keypoints as coordinates and use those coordinates in our game logic
No. of Classes
1 - (Time : 1 hour 30 minutes, Laptops/desktops : 10, Students strength : 15 to 20).
Check that the webcam works and note that ml5.js loads the model from the internet, so the internet connection is needed.
Start from the base code linked in Exercise 1. It already has the variables and the empty steps, so the students fill in the model loading and the drawing rather than typing the whole program.
Explain that this model is pre-trained - nobody in the class trained it. The program sends it a picture and it sends back a list of points.
Show the keypoints image linked in Exercise 1. Draw out that the model returns 21 numbered points per hand, not the word “hand” - point 8 is the index fingertip, which is why the code picks that one.
The results come back as an array, one entry per hand detected by the model. Detecting several hands is the same code reading more entries from that array.
Discuss where gesture control is already used - games, phones, cars, even electric chimneys at home and malls.
Points to Ponder:
We did not train this hand model. Somebody else did. What kind of pictures do you think they would have used to train it? Would it be supervised training or unsupervised training?
Where all do you think the hand model can be used in the real world? Discuss. Where would touch-free control be genuinely useful and where would it be worse than a button?